/* start module: client */
$pyjs.loaded_modules['client'] = function (__mod_name__) {
	if($pyjs.loaded_modules['client'].__was_initialized__) return $pyjs.loaded_modules['client'];
	var $m = $pyjs.loaded_modules["client"];
	$m.__repr__ = function() { return "<module: client>"; };
	$m.__was_initialized__ = true;
	if ((__mod_name__ === null) || (typeof __mod_name__ == 'undefined')) __mod_name__ = 'client';
	$m.__name__ = __mod_name__;


	$m['RootPanel'] = $p['___import___']('pyjamas.ui.RootPanel.RootPanel', null, null, false);
	$m['VerticalPanel'] = $p['___import___']('pyjamas.ui.VerticalPanel.VerticalPanel', null, null, false);
	$m['Label'] = $p['___import___']('pyjamas.ui.Label.Label', null, null, false);
	$m['TextBox'] = $p['___import___']('pyjamas.ui.TextBox.TextBox', null, null, false);
	$m['TextArea'] = $p['___import___']('pyjamas.ui.TextArea.TextArea', null, null, false);
	$m['Button'] = $p['___import___']('pyjamas.ui.Button.Button', null, null, false);
	$m['DialogBox'] = $p['___import___']('pyjamas.ui.DialogBox.DialogBox', null, null, false);
	$m['HTML'] = $p['___import___']('pyjamas.ui.HTML.HTML', null, null, false);
	$m['BackendProxy'] = $p['___import___']('BackendProxy.BackendProxy', null, null, false);
	$m['Window'] = $p['___import___']('pyjamas.Window', null, null, false);
	$m['NoteApp'] = (function(){
		var $cls_definition = new Object();
		var $method;
		$cls_definition.__module__ = 'client';
		$method = $pyjs__bind_method2('onModuleLoad', function() {
			if (this.__is_instance__ === true) {
				var self = this;
			} else {
				var self = arguments[0];
			}
			var vp;
			self.remote = $m['BackendProxy']();
			vp = $m['VerticalPanel']();
			self.notes_panel = $m['VerticalPanel']();
			vp['add']($m['HTML']('<h1>Hello World</h1>'));
			vp['add']($m['HTML']('<h2>Last 10 notes</h2>'));
			vp['add']($p['getattr'](self, 'notes_panel'));
			vp['add']($m['HTML']('<h2>add a note</h2>'));
			self.note_box = $m['TextBox']();
			vp['add']($p['getattr'](self, 'note_box'));
			vp['add']($m['Button']('save', $p['getattr'](self, 'post_note')));
			vp['add']($m['Button']('see source', $p['getattr'](self, 'see_source')));
			$m['RootPanel']()['add'](vp);
			self['remote']['get_notes'](self);
			return null;
		}
	, 1, [null,null,['self']]);
		$cls_definition['onModuleLoad'] = $method;
		$method = $pyjs__bind_method2('onRemoteResponse', function(response, request_info) {
			if (this.__is_instance__ === true) {
				var self = this;
			} else {
				var self = arguments[0];
				response = arguments[1];
				request_info = arguments[2];
			}
			var $sub3,$or1,$iter1_type,$or2,$add3,$sub2,$iter1_iter,$add2,item,$add1,$iter1_array,$add4,t,d,$iter1_nextval,$sub4,$sub1,$iter1_idx;
			if ($p['bool'](($p['bool']($or1=$p['op_eq']($p['getattr'](request_info, 'method'), 'get_notes'))?$or1:$p['op_eq']($p['getattr'](request_info, 'method'), 'post_note')))) {
				self['notes_panel']['clear']();
				$iter1_iter = response;
				$iter1_nextval=$p['__iter_prepare']($iter1_iter,false);
				while (typeof($p['__wrapped_next']($iter1_nextval).$nextval) != 'undefined') {
					item = $iter1_nextval.$nextval;
					self['notes_panel']['add']($m['Label']($p['__op_add']($add3=$p['__op_add']($add1=item.__getitem__('content'),$add2=' | '),$add4=item.__getitem__('date'))));
				}
			}
			else if ($p['bool']($p['op_eq']($p['getattr'](request_info, 'method'), 'get_source'))) {
				d = $pyjs_kwargs_call(null, $m['DialogBox'], null, null, [{autoHide:true, glass:true}]);
				d['setHTML']('Source');
				d['setPopupPosition'](100, 100);
				t = $m['TextArea']();
				t['setWidth']($p['__op_sub']($sub1=$m['Window']['getClientWidth'](),$sub2=200));
				t['setHeight']($p['__op_sub']($sub3=$m['Window']['getClientHeight'](),$sub4=200));
				t['setText'](response.__getitem__(0));
				d['setWidget'](t);
				d['show']();
			}
			return null;
		}
	, 1, [null,null,['self'],['response'],['request_info']]);
		$cls_definition['onRemoteResponse'] = $method;
		$method = $pyjs__bind_method2('onRemoteError', function(code, message, request_info) {
			if (this.__is_instance__ === true) {
				var self = this;
			} else {
				var self = arguments[0];
				code = arguments[1];
				message = arguments[2];
				request_info = arguments[3];
			}

			$p['printFunc'](['Remote Error!'], 1);
			return null;
		}
	, 1, [null,null,['self'],['code'],['message'],['request_info']]);
		$cls_definition['onRemoteError'] = $method;
		$method = $pyjs__bind_method2('post_note', function() {
			if (this.__is_instance__ === true) {
				var self = this;
			} else {
				var self = arguments[0];
			}

			self['remote']['post_note'](self, self['note_box']['getText']());
			return null;
		}
	, 1, [null,null,['self']]);
		$cls_definition['post_note'] = $method;
		$method = $pyjs__bind_method2('see_source', function() {
			if (this.__is_instance__ === true) {
				var self = this;
			} else {
				var self = arguments[0];
			}

			self['remote']['get_source'](self);
			return null;
		}
	, 1, [null,null,['self']]);
		$cls_definition['see_source'] = $method;
		var $bases = new Array(pyjslib.object);
		var $data = $p['dict']();
		for (var $item in $cls_definition) { $data.__setitem__($item, $cls_definition[$item]); }
		return $p['_create_class']('NoteApp', $p['tuple']($bases), $data);
	})();
	if ($p['bool']($p['op_eq']((typeof __name__ == "undefined"?$m.__name__:__name__), '__main__'))) {
		$m['app'] = $m['NoteApp']();
		$m['app']['onModuleLoad']();
	}
	return this;
}; /* end client */


/* end module: client */


/*
PYJS_DEPS: ['pyjamas.ui.RootPanel.RootPanel', 'pyjamas', 'pyjamas.ui', 'pyjamas.ui.RootPanel', 'pyjamas.ui.VerticalPanel.VerticalPanel', 'pyjamas.ui.VerticalPanel', 'pyjamas.ui.Label.Label', 'pyjamas.ui.Label', 'pyjamas.ui.TextBox.TextBox', 'pyjamas.ui.TextBox', 'pyjamas.ui.TextArea.TextArea', 'pyjamas.ui.TextArea', 'pyjamas.ui.Button.Button', 'pyjamas.ui.Button', 'pyjamas.ui.DialogBox.DialogBox', 'pyjamas.ui.DialogBox', 'pyjamas.ui.HTML.HTML', 'pyjamas.ui.HTML', 'BackendProxy.BackendProxy', 'BackendProxy', 'pyjamas.Window']
*/
